package com.gwt.client.login.client;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class NurseUI {

	private JFrame frame;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					NurseUI window = new NurseUI();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public NurseUI() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JLabel lblWelcomeNuse = new JLabel("Welcome Nurse");
		lblWelcomeNuse.setFont(new Font("Tahoma", Font.BOLD, 15));
		
		JButton btnCreateButton = new JButton("Add Patient");
		btnCreateButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				CreatePatientUI cpui = new CreatePatientUI();
				cpui.setd(false);
				cpui.setVisible(true);
				frame.setVisible(false);
				frame.dispose();
			}
		});
		
		JButton btnLogout = new JButton("Logout");
		btnLogout.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				LoginUI login = new LoginUI();
				login.setVisible(true);
				frame.setVisible(false);
				frame.dispose();
			}
		});
		
		JButton btnLookupPatient = new JButton("Lookup Patient");
		btnLookupPatient.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				LookUpPatientUI lupui = new LookUpPatientUI();
				lupui.setVisible(true);
			}
		});
		
		JButton btnSchedule = new JButton("View Appointments");
		btnSchedule.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				DailyAppointmentUI apptui = new DailyAppointmentUI();
				apptui.setVisible(true);
			}
		});
		GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(175)
							.addComponent(btnLogout))
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(148)
							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
								.addComponent(lblWelcomeNuse)
								.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
									.addComponent(btnCreateButton, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
									.addComponent(btnSchedule, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
									.addComponent(btnLookupPatient, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
					.addContainerGap(163, Short.MAX_VALUE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(29)
					.addComponent(lblWelcomeNuse)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(btnCreateButton)
					.addGap(27)
					.addComponent(btnLookupPatient)
					.addGap(29)
					.addComponent(btnSchedule)
					.addPreferredGap(ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
					.addComponent(btnLogout)
					.addContainerGap())
		);
		frame.getContentPane().setLayout(groupLayout);
	}
	
	/**
	 * 
	 * @param b
	 */
	public void setVisible(boolean b){
		frame.setVisible(b);
	}
}
